#ifndef VSSOCKET_H
#define VSSOCKET_H
#include "map.h"
#include <QTcpSocket>
#define NETVERSION 0xa001
class VSSocket : public QTcpSocket
{
	enum MessageType {welcome,step,talk,error,waiting,start};

    Q_OBJECT
public:
	enum ErrorType {full,versionWrong,unknow};
	explicit VSSocket(QObject *parent = 0);
	const QString& getNickName();
public slots:
	void readClient();
	void sendWelcomeMessage();
	void sendErrorMessage(ErrorType e);
	void sendStepMessage(const Steps &s);
	void sendTalkMessage(const QString &s);
	void sendStartMessage(bool color);
signals:
	void moved(int,int,int,int);
	void talked(QString);
	void erred(QString);
	void ready();
	void sendMsg(QString);
	void started();
public slots:
private:
	QString nickName;
	quint16 nextBlockSize;
	MessageType mes;
};

#endif // VSSOCKET_H
